<template>
    <div>
        <ul>
            <li :class="current === i ? 'active' : ''" v-for="(item, i) in imgs" :key="i" @click="choseType(item, i)">
                <img :src="item" alt="">
            </li>
        </ul>
    </div>
</template>

<script>
import img1 from '@/assets/img1.jpg'
import img2 from '@/assets/img2.jpg'
import img3 from '@/assets/img3.jpg'
import img4 from '@/assets/img4.jpg'
import img5 from '@/assets/img5.jpg'
export default {
  name: '',
  props:['num'],
  data() { 
    return {
        imgs: [img1, img2, img3, img4, img5],
        current: -1
    }
  },
  created() {

  },
  methods:{
      choseType(item, i) {
          this.current = i
          this.$emit('getimg', item)
      }
  },

  watch: {
    num() {
        this.current = this.num
    }
  }
 }
</script>

<style scoped lang="scss">
ul{
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
    li {
        width: 60px;
        height: 60px;
        img{
            width: 100%;
            height: 100%;
        }
    }
    .active{
        border: 3px solid red;
    }
}
</style>